﻿using System.Windows;
using System.Windows.Navigation;
using CodeBadger.GasMileage.ViewModels;

namespace CodeBadger.GasMileage.Views
{
    public partial class EmailDataPage
    {
        private EmailViewModel Vm
        {
            get { return DataContext as EmailViewModel; }
        }

        public EmailDataPage()
        {
            InitializeComponent();
        }

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            InitializeViewModel();
        }

        private void InitializeViewModel()
        {

            var vm = new EmailViewModel();
            DataContext = vm;
        }

        private void ButtonClick(object sender, RoutedEventArgs e)
        {
            if (Vm.SendEmail())
            {
                NavigationService.GoBack();
            }
        }
    }
}